#if !defined(AFX_WINMACRODIALOG2_H__E02D3C42_E7A5_11D7_8ECB_CA2C320FC576__INCLUDED_)
#define AFX_WINMACRODIALOG2_H__E02D3C42_E7A5_11D7_8ECB_CA2C320FC576__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// WinMacroDialog2.h : header file
//
#include "resource.h"

#include "fstream"
#include "resource.h"
#include <afxcmn.h>

#include "../WinMacroLib/WinMacroLib.h"
#include "WinMacro.h"
#include "StatusWindow.h"
using namespace std;

/////////////////////////////////////////////////////////////////////////////
// WinMacroDialog2 dialog
class WinMacroDialog2 : public CDialog
{
	CStatusBarCtrl statusbar;
	
	DWORD action_start_time;
	Status status;
	StatusWindow *m_pStatusWindow;
	
	PLAYBACKPROGRESSINFO playback_progress_info;

	void InitializeOptions();

	void ShowFileDialog(CEdit *textbox);
	BOOL CheckFileName(const std::string &filename, const std::string &error_mesg, bool must_exist = false);
	void EnableDisableUI(BOOL p);

	void ShowStatusWindow();
	void HideStatusWindow();

	LRESULT OnStopRecording(WPARAM, LPARAM);
	LRESULT OnStopPlayback(WPARAM, LPARAM);
	void OnHotKey(UINT nHotKeyId, UINT modifiers, UINT key);
	void OnClose();
	void RegisterHotkeys();
	void ShowError(DWORD error);
// Construction
public:
	WinMacroDialog2(CWnd* pParent = NULL);   // standard constructor
	
	void StopRecording();
	void StopPlayback();
	void StartRecordingWithCurrentSettings();
	void StartRecording(const std::string &filename, const RECORDINGOPTIONS &recording_options);
	void StartPlaybackWithCurrentSettings();
	void StartPlayback(const std::string &filename, const PLAYBACKOPTIONS &playback_options);
	void FinishedPlayback();
	void ReportPlaybackProgress(PLAYBACKPROGRESSINFO progress_info);
	Status GetStatus () { return status; }
	DWORD GetActionStartTime() { return action_start_time; }
	PLAYBACKPROGRESSINFO GetPlaybackProgressInfo() { return playback_progress_info; }
	void SaveLastMacroFileName();
	
// Dialog Data
	//{{AFX_DATA(WinMacroDialog2)
	enum { IDD = IDD_WINMACRO2 };
	CButton	m_options_button;
	CButton	m_browse_button;
	CEdit	m_filename;
	CButton	m_playback_button;
	CButton	m_record_button;
	//}}AFX_DATA

	CString m_initialPath;

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(WinMacroDialog2)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(WinMacroDialog2)
	virtual BOOL OnInitDialog();
	afx_msg void OnRecord_Click();
	afx_msg void OnPlayback_Click();
	afx_msg void OnBrowse_Click();
	afx_msg void OnAbout_Click();
	afx_msg void OnOptions_Click();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_WINMACRODIALOG2_H__E02D3C42_E7A5_11D7_8ECB_CA2C320FC576__INCLUDED_)
